﻿CREATE TABLE [dbo].[Finance_Outlay] (
    [Id]              INT              IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
    [RId]             UNIQUEIDENTIFIER CONSTRAINT [DF_Finance_Outlay_RId] DEFAULT (newid()) ROWGUIDCOL NULL,
    [CreateDate]      DATETIME         NULL,
    [TradeDate]       NVARCHAR (10)    NULL,
    [Summary]         NVARCHAR (500)   NULL,
    [CateOneId]       INT              NULL,
    [CateOneName]     NVARCHAR (50)    NULL,
    [CateTwoId]       INT              NULL,
    [CateTwoName]     NVARCHAR (50)    NULL,
    [SubjectId]       INT              NULL,
    [SubjectName]     NVARCHAR (50)    NULL,
    [PaymentTypeId]   INT              NULL,
    [PaymentTypeName] NVARCHAR (50)    NULL,
    [BankId]          INT              NULL,
    [BankName]        NVARCHAR (50)    NULL,
    [OutlayReason]    NVARCHAR (MAX)   NULL,
    [OutlayPrice]     DECIMAL (18, 2)  NULL,
    [Agent]           NVARCHAR (50)    NULL,
    [AgentName]       NVARCHAR (50)    NULL,
    [PZPerson]        NVARCHAR (50)    NULL,
    [PZPersonName]    NVARCHAR (50)    NULL,
    [SHPerson]        NVARCHAR (50)    NULL,
    [SHPersonName]    NVARCHAR (50)    NULL,
    [BillNumber]      NVARCHAR (50)    NULL,
    [Description]     NVARCHAR (2000)  NULL,
    [UserName]        NVARCHAR (50)    NULL,
    [EName]           NVARCHAR (50)    NULL,
    [CompanyId]       INT              NULL,
    [CompanyIdCur]    INT              NULL,
    [DepartmentIdCur] INT              NULL,
    [A_tx]            INT              CONSTRAINT [DF_Finance_Outlay_A_tx] DEFAULT ((0)) NULL,
    [A_txflag]        INT              CONSTRAINT [DF_Finance_Outlay_A_txflag_1] DEFAULT ((0)) NULL,
    [A_txqsy]         VARCHAR (10)     CONSTRAINT [DF_Finance_Outlay_A_txqsy_1] DEFAULT ('') NULL,
    [A_txys]          INT              CONSTRAINT [DF_Finance_Outlay_A_txys_1] DEFAULT ((0)) NULL,
    [A_txbz]          NVARCHAR (500)   CONSTRAINT [DF_Finance_Outlay_A_txbz_1] DEFAULT ('') NULL,
    [A_UserName]      NVARCHAR (20)    NULL,
    [A_UserId]        VARCHAR (20)     NULL,
    [A_Date]          DATETIME         NULL,
    [l_id]            INT              CONSTRAINT [DF_Finance_Outlay_l_id] DEFAULT ((0)) NULL,
    [l_type]          CHAR (10)        CONSTRAINT [DF_Finance_Outlay_l_type] DEFAULT ('') NULL,
    [cb_flag]         INT              CONSTRAINT [DF_Finance_Outlay_cb_flag] DEFAULT ((0)) NULL,
    CONSTRAINT [PK_Finance_Outlay] PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_Finance_Outlay]
    ON [dbo].[Finance_Outlay]([BankId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_Finance_Outlay_1]
    ON [dbo].[Finance_Outlay]([CreateDate] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_Finance_Outlay_2]
    ON [dbo].[Finance_Outlay]([CateOneId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_Finance_Outlay_3]
    ON [dbo].[Finance_Outlay]([CateTwoId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_Finance_Outlay_4]
    ON [dbo].[Finance_Outlay]([PaymentTypeId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_Finance_Outlay_5]
    ON [dbo].[Finance_Outlay]([CompanyId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_TradeDate]
    ON [dbo].[Finance_Outlay]([TradeDate] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_SubjectId]
    ON [dbo].[Finance_Outlay]([SubjectId] ASC);


GO
CREATE NONCLUSTERED INDEX [EFS_IX_Finance_Outlay_43acd736385d484780485c9e50b7e2c3]
    ON [dbo].[Finance_Outlay]([CateTwoId] ASC, [CompanyIdCur] ASC, [CreateDate] ASC)
    INCLUDE([OutlayPrice]);


GO
CREATE NONCLUSTERED INDEX [EFS_IX_Finance_Outlay_c40f741b0af84f56a6d31edf9bb430b6]
    ON [dbo].[Finance_Outlay]([SubjectId] ASC, [CompanyIdCur] ASC, [CreateDate] ASC)
    INCLUDE([OutlayPrice]);


GO
CREATE NONCLUSTERED INDEX [EFS_IX_Finance_Outlay_347ab2afef724ae2a4a3dec6732000fa]
    ON [dbo].[Finance_Outlay]([CompanyIdCur] ASC, [CreateDate] ASC, [SubjectId] ASC)
    INCLUDE([OutlayPrice]);


GO
CREATE NONCLUSTERED INDEX [EFS_IX_Finance_Outlay_d589caa84af74f6faca5b15ee19ca0d0]
    ON [dbo].[Finance_Outlay]([CompanyIdCur] ASC, [cb_flag] ASC, [CreateDate] ASC)
    INCLUDE([PaymentTypeId], [BankId], [OutlayPrice]);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'是否摊销(0:否，1是)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_tx';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'是否已摊销（0：未摊销，1：已摊销）', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_txflag';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'摊销起始月', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_txqsy';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'摊销月数', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_txys';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'摊销备注', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_txbz';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'摊销人', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_UserName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'摊销日期', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'A_Date';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'报销ID', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'l_id';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'是否参与日报计算，0：参与，1：不参与。为0时是由支出审核时产生的成本', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Finance_Outlay', @level2type = N'COLUMN', @level2name = N'cb_flag';

